﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Templates/Template.Master"
     Inherits="System.Web.Mvc.ViewPage<TaxiCaosWeb.Models.Unidad>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
    Eliminación de Unidades
</asp:Content>
 
<asp:Content ID="Content3" ContentPlaceHolderID="menuContent" runat="server">
 <%
    string[] menuArray = { "0", "0", "0", "0", "0", "1", "0", "0" };
    Session["menuArray"] = menuArray;
%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">

    <script type="text/javascript">


        $(document).ready(function () {


            // validar formulario
            $("#unidadForm").validate({
                submitHandler: function (form) {
                    submitForm("");
                },
                rules: {
                    Placa: "required"
                }
            });

        });

        function submitForm() {

            var $form = $("#unidadForm");

            $.ajax({
                type: "POST",
                url: $form.attr('action'),
                data: $form.serialize(),
                error: function (xhr, status, error) {
                    $.msgBox({
                        content: error,
                        type: "error"
                    });
                },
                success: function (data) {
                    $("#loading-div-background").hide();
                    if (data.tipoMensaje == 'INFO') {
                        $.msgBox({
                            content: data.mensaje,
                            type: "info",
                            afterClose: function () {
                                window.location = data.redirectTo;
                            }
                        });
                    } else if (data.tipoMensaje == 'WARN') {
                        $.msgBox({
                            content: data.mensaje,
                            type: "alert"
                        });
                    }

                },
                beforeSend: function (data) {
                    $("#loading-div-background").show();
                }
            });

            return false;
        }

    </script>


    <div class="nosotros">
        <h2>
            Eliminar Unidades</h2>

         <div style="margin-top: 5px; height: 285px; overflow-y: scroll;">

         <% using (Html.BeginForm("EliminarUnidad", "Administracion", FormMethod.Post, new { @id = "unidadForm", @class = "cmxform" }))
                   {%>
        <br />
        <fieldset>
          <legend><b>Datos Unidades</b></legend>
          <%: Html.TextBoxFor(model => model.IdUnidad, new { @style = "display:none;" })%>
            <table style="width:100%;">
                <tr>
                    <td>Marca</td>
                    <td><%= Html.DropDownList("IdMarca", (IEnumerable<SelectListItem>)ViewData["Marca"], new { @disabled = "" })%></td>
                </tr>
                <tr>
                    <td>Tipo Unidad</td>
                    <td><%= Html.DropDownList("Tipo", (IEnumerable<SelectListItem>)ViewData["TipoUnidad"], new { @disabled = "" })%></td>
                </tr>
                <tr>
                    <td>
                       Placa (*)
                    </td>
                    <td style="width: 200px;">                                
                         <%: Html.TextBoxFor(model => model.Placa, new { @disabled = "", @class = "required", @style = "width:180px;" })%>                     
                    </td>
                </tr>
                <tr>
                <td>Estado</td>
                  <td><%= Html.DropDownList("Estado", (IEnumerable<SelectListItem>)ViewData["EstadoUnidad"], new { @disabled = "" })%></td>
                </tr>
            </table>
        </fieldset>
         <br />

         <input id="btnSubmit" type="submit" value="Confirmar Eliminiación" style="background-color: steelblue;
                color: white; font-weight: bold; margin-top: 5px;" />

       <% } %>     
         
       </div>  
    </div>

</asp:Content>
